﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Text;
using System.Data;

namespace IHISCETeim.Web.MachineSys.FXModel
{
    public partial class SAreaManagerMasterList : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看, Permission.修改, Permission.新增, Permission.删除 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "SAreaManagerMasterList";
            }


        }

        protected void Page_Load(object sender, EventArgs e)
        {
            // Response.Write(GetFolderTree(0));
        }
        /// <summary>
        /// '''营业一部'',''风险部'''
        /// </summary>
        /// <returns></returns>
        private string getdept()
        {
            string[] depelist = new string[] { "营业部", "营业一部", "营业二部", "营业三部" };
            string restr = "";
            foreach (string itm in depelist)
            {
                restr += string.Format("'{0}',",itm);
            }

            return  restr.Substring(0, restr.Length - 1);
        }
        protected string GetFolderTree(int ParFolderID)
        {
            DataTable list = OUserController.GetUserByDepartment(getdept());
            if (list.Rows.Count <= 0)
                return "";

            /// <ul><li><a href="JSDWF/JSDWFFolderPageList.aspx?ParFolderID=1" target="ajax" rel="jbsxBox">尿检</a></li></ul>
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul>");
            foreach (DataRow itm in list.Rows)
            {
                sb.Append("<li>");
                sb.AppendFormat("<a href=\"FXModel/SAreaManagerAgentDetail.aspx?UserId={0}\" target=\"ajax\" rel=\"SAreaManagerAgentDetail\">{1}</a>", itm["UserId"], itm["RealName"]);

               // sb.Append(GetFolderTree(itm.FolderID));

                sb.Append("</li>");
            }
            sb.Append("</ul>");

            return sb.ToString();
        }
    }
}